<?php 
// +----------------------------------------------------------------------
// | ThinkPHP                                                             
// +----------------------------------------------------------------------
// | Copyright (c) 2008 http://thinkphp.cn All rights reserved.      
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>                                  
// +----------------------------------------------------------------------
// $Id$

// 数据输出管理类
class Output extends Base {

	protected $filter	=	null;	//	输出过滤

    /**
     +----------------------------------------------------------
     * 魔术方法 有不存在的操作的时候执行
     +----------------------------------------------------------
     * @access public 
     +----------------------------------------------------------
     * @param string $type 输出数据类型 
     * @param array $args 参数 array(name,content,filter)
     +----------------------------------------------------------
     * @return mixed 
     +----------------------------------------------------------
     */	
	public function __call($type,$args=array()) {
		$name	=	array_shift($args);
		$data		=	array_shift($args);
		$filter	=	isset($args[0])?$args[0]:$this->filter;
		if(!empty($filter)) {
			$data	 =	 call_user_func_array($filter,array($data));
		}
		switch(strtolower(trim($type))) {
			case 'file':
				$result	 = file_put_contents($name,$data);
				break;
			case 'mem':
				break;
			case 'cookie':
				$result	=	$_COOKIE[$name,$data];
				break;
			case 'session':
				break;
			case 'browser':
				break;
			case 'xcache':
				break;
			case 'system':
				echo 
				break;
		}

	}
}
?>